package com.ftg.learn.chapter12.springbootdemo.mapper;

import com.ftg.learn.chapter12.springbootdemo.entity.TeachersEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 描述     映射器文件
 *
 * @author 布衣
 * @date 2024/9/20
 */
@Mapper
public interface TeachersMapper {

    @Select("select teacher_id teacherId,teacher_name teacherName,department from teachers")
    List<TeachersEntity> list();

    @Select("select * from teachers where teacher_name = #{teacherName}")
    List<TeachersEntity> findOneByName(@Param("teacherName") String teacherName);

    @Insert("insert into teachers(teacher_name,department) values(#{teacherName},#{department})")
    int save(TeachersEntity t);

    @Delete("delete from teachers where teacher_id =#{id}")
    int delById(@Param("id") Integer id);
}
